/* ============ 防错乱基线 ============ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; max-width: 100%; overflow-x: hidden; }
img, video, iframe, embed, object { max-width: 100%; height: auto; display: block; }
img { object-fit: cover; }
table { max-width: 100%; }
pre, code { white-space: pre-wrap; word-break: break-word; overflow: auto; max-width: 100%; }
a, p, h1, h2, h3, li, span { overflow-wrap: anywhere; word-break: break-word; }
.container { width: 100%; max-width: 1220px; margin: 0 auto; padding: 0 16px; }
main, section, article, aside { position: relative; }

/* ============ 变量与全局 ============ */
:root {
  --bg: #f5f3f0;
  --card: #ffffff;
  --ink: #2b2724;
  --muted: #8a817a;
  --line: #e8e3dd;
  --accent: #e8622c;
  --accent-dark: #c94f1e;
  --pill-a: #fdeade;
  --pill-b: #f3ece4;
  --pill-c: #efe6dc;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.7;
}
a { color: var(--ink); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent); }
h1, h2, h3, .sec-title, .side-title, .hero-title, .error-title {
  font-family: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  line-height: 1.35;
}
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ============ 头部（双层） ============ */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); }
.header-top {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding-top: 14px; padding-bottom: 14px;
}
.site-logo { display: flex; align-items: baseline; gap: 8px; flex-shrink: 0; }
.site-logo strong {
  font-family: Georgia, "Times New Roman", "Songti SC", serif;
  font-size: 24px; color: var(--accent-dark); letter-spacing: 1px;
}
.logo-sub { font-size: 12px; color: var(--muted); }
.header-search {
  display: flex; flex: 1 1 320px; min-width: 0; max-width: 480px;
  background: var(--bg); border-radius: 999px; overflow: hidden;
}
.search-input {
  flex: 1 1 auto; min-width: 0; border: 0; background: transparent;
  padding: 9px 16px; font-size: 16px; color: var(--ink); outline: none;
}
.search-btn {
  flex-shrink: 0; border: 0; background: var(--accent); color: #fff;
  padding: 0 22px; font-size: 14px; cursor: pointer; border-radius: 999px;
  transition: background .2s;
}
.search-btn:hover { background: var(--accent-dark); }
.nav-toggle {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 42px; height: 38px; padding: 8px 10px; margin-left: auto;
  border: 0; background: var(--bg); border-radius: 8px; cursor: pointer;
}
.nav-toggle .bar { display: block; width: 100%; height: 2px; background: var(--ink); }

.header-navbar { background: var(--card); border-top: 1px solid var(--line); }
.site-nav { display: flex; flex-wrap: wrap; gap: 10px; padding: 10px 0; }
.site-nav a {
  display: inline-block; padding: 6px 18px; border-radius: 999px;
  font-size: 14px; background: var(--pill-b); color: var(--ink);
}
.site-nav a:nth-child(3n+1) { background: var(--pill-a); }
.site-nav a:nth-child(3n+2) { background: var(--pill-b); }
.site-nav a:nth-child(3n) { background: var(--pill-c); }
.site-nav a:hover { background: var(--accent); color: #fff; }
.site-nav a.nav-home { background: var(--accent); color: #fff; }
.site-nav a.nav-home:hover { background: var(--accent-dark); }

/* ============ 首页：排行条 ============ */
.home-page { padding-top: 24px; }
.sec-title { font-size: 22px; margin: 0 0 16px; padding-left: 12px; border-left: 4px solid var(--accent); }
.rank-strip { margin-bottom: 28px; }
.rank-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px; counter-reset: rank;
}
.rank-item {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  background: var(--card); padding: 10px 14px; border-radius: 8px;
}
.rank-item::before {
  counter-increment: rank; content: counter(rank);
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 6px;
  background: var(--pill-c); color: var(--muted);
  font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.rank-item:nth-child(-n+3)::before { background: var(--accent); color: #fff; }
.rank-title {
  flex: 1 1 auto; min-width: 0; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.rank-views { flex-shrink: 0; font-size: 12px; color: var(--muted); }

/* ============ 首页：Banner ============ */
.hero { margin-bottom: 32px; }
.hero-media {
  position: relative; overflow: hidden; border-radius: 10px;
  aspect-ratio: 12 / 5; background: var(--pill-c);
}
.hero-media img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.82) contrast(1.03); }
.hero-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 48px 32px 28px;
  background: linear-gradient(to top, rgba(30, 22, 16, .82), rgba(30, 22, 16, 0));
  color: #fff;
}
.hero-title { margin: 0 0 8px; font-size: 28px; color: #fff; }
.hero-desc {
  margin: 0 0 14px; font-size: 14px; color: rgba(255, 255, 255, .88);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-btn {
  display: inline-block; background: var(--accent); color: #fff;
  padding: 8px 26px; border-radius: 999px; font-size: 14px;
}
.hero-btn:hover { background: var(--accent-dark); color: #fff; }

/* ============ 双栏布局 ============ */
.home-layout, .page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(280px, 24vw, 330px);
  gap: 28px; align-items: start;
}
.home-main, .page-main, .side-col { min-width: 0; }
.home-block { margin-bottom: 36px; }

/* ============ 海报卡片网格 ============ */
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 20px 16px;
}
.poster-card { min-width: 0; background: var(--card); border-radius: 8px; padding-bottom: 12px; overflow: hidden; }
.poster-link { display: block; min-width: 0; }
.poster-thumb {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 2 / 3; background: var(--pill-c);
}
.poster-thumb img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.82) contrast(1.02); transition: transform .25s; }
.poster-card:hover .poster-thumb img { transform: scale(1.03); }
.badge-hot, .badge-fire {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  padding: 2px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #ff8a3d, #e8622c);
  letter-spacing: 1px;
}
.badge-fire { background: linear-gradient(135deg, #ff5f3d, #c9341e); }
.card-title {
  margin: 10px 12px 4px; font-size: 15px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-intro {
  margin: 0 12px 4px; font-size: 12px; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-meta { margin: 0 12px; font-size: 12px; color: var(--muted); }
.card-meta a { color: var(--accent-dark); }
.card-meta a:hover { color: var(--accent); }

/* ============ 侧栏 ============ */
.side-block { background: var(--card); border-radius: 8px; padding: 16px 16px 18px; margin-bottom: 20px; }
.side-title { font-size: 17px; margin: 0 0 12px; padding-left: 10px; border-left: 3px solid var(--accent); }
.side-rank li, .side-list li {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 7px 0; border-bottom: 1px dashed var(--line);
}
.side-rank li:last-child, .side-list li:last-child { border-bottom: 0; }
.side-rank { counter-reset: srank; }
.side-rank li::before {
  counter-increment: srank; content: counter(srank);
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 4px;
  background: var(--pill-c); color: var(--muted); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.side-rank li:nth-child(-n+3)::before { background: var(--accent); color: #fff; }
.side-rank a, .side-list a {
  flex: 1 1 auto; min-width: 0; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-views { flex-shrink: 0; font-size: 12px; color: var(--muted); }
.side-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.side-tags a {
  display: inline-block; padding: 4px 14px; border-radius: 999px;
  font-size: 12px; background: var(--pill-b);
}
.side-tags a:nth-child(3n+1) { background: var(--pill-a); }
.side-tags a:nth-child(3n) { background: var(--pill-c); }
.side-tags a:hover { background: var(--accent); color: #fff; }
.side-search { display: flex; min-width: 0; background: var(--bg); border-radius: 999px; overflow: hidden; }

/* ============ 面包屑与分页 ============ */
.page-wrap { padding-top: 20px; }
.breadcrumb { margin-bottom: 18px; font-size: 13px; color: var(--muted); }
.breadcrumb ol { display: flex; flex-wrap: wrap; gap: 4px; }
.breadcrumb li { display: flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "/"; margin: 0 8px; color: var(--line); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.list-title { font-size: 26px; margin: 0 0 20px; padding-left: 12px; border-left: 4px solid var(--accent); }
.pagination {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
  margin: 30px 0 10px;
}
.pagination a {
  display: inline-block; min-width: 38px; padding: 7px 12px; text-align: center;
  background: var(--card); border-radius: 8px; font-size: 14px;
}
.pagination a:hover { background: var(--accent); color: #fff; }

/* ============ 播放器模块 ============ */
.player-module { margin-bottom: 26px; background: #17120e; border-radius: 10px; overflow: hidden; }
.player-wrap {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  overflow: hidden; background: #000;
}
.hls-player { width: 100%; height: 100%; object-fit: contain; background: #000; }
.player-server { color: #cbbfb4; font-size: 13px; }
.player-server:empty { display: none; }
.player-server > * { max-width: 100%; }

/* ============ 视频详情 ============ */
.video-detail { background: var(--card); border-radius: 10px; padding: 22px; margin-bottom: 30px; }
.detail-head {
  display: grid; grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 22px; margin-bottom: 8px;
}
.detail-poster { min-width: 0; }
.detail-poster img {
  width: 100%; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 8px; filter: saturate(.85);
}
.detail-info { min-width: 0; }
.detail-info h1 { margin: 0 0 10px; font-size: 26px; }
.score-line { margin: 0 0 12px; font-size: 14px; color: var(--muted); }
.score-num { color: var(--accent); font-size: 24px; font-family: Georgia, serif; }
.meta-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px 18px; }
.meta-list li { min-width: 0; font-size: 13px; color: var(--ink); }
.meta-list li span { color: var(--muted); margin-right: 8px; }
.detail-intro, .detail-content { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.detail-intro h2, .detail-content h2 { font-size: 18px; margin: 0 0 10px; }
.detail-intro p { margin: 0; font-size: 14px; color: #4c453f; }
.rich-content { font-size: 14px; color: #4c453f; }
.rich-content img { margin: 12px auto; border-radius: 6px; }
.rich-content table { display: block; overflow-x: auto; }
.related-block { margin-bottom: 30px; }

/* ============ 搜索结果 ============ */
.search-tip { margin: 0 0 18px; font-size: 13px; color: var(--muted); }
.search-results { display: grid; grid-template-columns: 1fr; gap: 14px; }
.result-card {
  display: flex; gap: 16px; min-width: 0;
  background: var(--card); border-radius: 8px; padding: 14px;
}
.result-thumb {
  flex-shrink: 0; display: block; width: 110px;
  aspect-ratio: 2 / 3; overflow: hidden; border-radius: 6px; background: var(--pill-c);
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.result-body { flex: 1 1 auto; min-width: 0; }
.result-body .card-title { margin: 0 0 6px; }
.result-body .card-intro { margin: 0 0 8px; -webkit-line-clamp: 3; }
.result-body .card-meta { margin: 0; }
.no-result {
  margin-top: 18px; padding: 22px; text-align: center;
  background: var(--card); border-radius: 8px; color: var(--muted); font-size: 14px;
}
.search-results:not(:empty) + .no-result { display: none; }

/* ============ 关于我们 ============ */
.about-page { background: var(--card); border-radius: 10px; padding: 28px; margin-bottom: 30px; }
.about-page h1 { margin: 0 0 18px; font-size: 26px; padding-left: 12px; border-left: 4px solid var(--accent); }
.about-block { margin-bottom: 22px; }
.about-block h2 { font-size: 18px; margin: 0 0 10px; }
.about-block p { margin: 0 0 10px; font-size: 14px; color: #4c453f; }
.about-contact li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.about-contact li:last-child { border-bottom: 0; }

/* ============ 页脚 ============ */
.site-footer { background: #2b2420; color: #b8ada3; margin-top: 40px; }
.footer-inner {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px; padding-top: 34px; padding-bottom: 26px;
}
.footer-col { min-width: 0; }
.footer-title { margin: 0 0 10px; }
.footer-title strong { color: #fff; font-size: 16px; font-family: Georgia, "Songti SC", serif; }
.footer-col p { margin: 0 0 8px; font-size: 13px; }
.footer-col a { color: #b8ada3; }
.footer-col a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid #3d342e; padding: 14px 0; }
.footer-bottom p { margin: 0; font-size: 12px; text-align: center; color: #8f847a; }
.footer-bottom a { color: #b8ada3; }
.footer-bottom a:hover { color: var(--accent); }

/* ============ 404 ============ */
.error-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 24px;
}
.error-box {
  width: 100%; max-width: 460px; background: var(--card);
  border-radius: 12px; padding: 40px 30px; text-align: center;
}
.error-code { margin: 0; font-size: 72px; font-weight: 700; color: var(--accent); font-family: Georgia, serif; line-height: 1; }
.error-title { margin: 12px 0 8px; font-size: 22px; }
.error-desc { margin: 0 0 20px; font-size: 14px; color: var(--muted); }
.error-search { display: flex; min-width: 0; background: var(--bg); border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.error-home {
  display: inline-block; padding: 9px 30px; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: 14px;
}
.error-home:hover { background: var(--accent-dark); color: #fff; }

/* ============ 响应式 ============ */
@media (max-width: 1024px) {
  .home-layout, .page-layout { grid-template-columns: minmax(0, 1fr); }
  .side-col { margin-top: 8px; }
  .hero-title { font-size: 22px; }
}
@media (max-width: 768px) {
  .header-top { gap: 12px; }
  .header-search { order: 3; flex: 1 1 100%; max-width: none; }
  .nav-toggle { display: flex; }
  .header-navbar .container { padding: 0; }
  .site-nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
    flex-direction: column; gap: 0; padding: 8px 16px 14px;
    background: var(--card); border-bottom: 1px solid var(--line);
    max-height: calc(100vh - 120px); overflow-y: auto;
  }
  .header-navbar { position: relative; }
  .site-nav.is-open { display: flex; }
  .site-nav a { width: 100%; margin: 4px 0; text-align: center; padding: 10px 18px; }
  .hero-media { aspect-ratio: 16 / 10; }
  .hero-overlay { padding: 32px 18px 18px; }
  .hero-title { font-size: 19px; }
  .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .rank-grid { grid-template-columns: minmax(0, 1fr); }
  .detail-head { grid-template-columns: minmax(0, 1fr); }
  .detail-poster { max-width: 220px; margin: 0 auto; }
  .result-card { flex-direction: row; }
  .result-thumb { width: 90px; }
  .video-detail, .about-page { padding: 16px; }
  .list-title, .detail-info h1 { font-size: 21px; }
  .sec-title { font-size: 19px; }
}
@media (max-width: 480px) {
  .container { padding: 0 12px; }
  .logo-sub { display: none; }
  .result-card { flex-direction: column; }
  .result-thumb { width: 100%; max-width: 180px; }
}